// 添加缺少的命名空间
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Sales.Mvc.Models;
using System.Diagnostics;

namespace Sales.Mvc.Controllers
{
    public class HomeController : Controller
    {
        private readonly ILogger<HomeController> _logger;

        public HomeController(ILogger<HomeController> logger)
        {
            _logger = logger;
        }

        public IActionResult Index()
        {
            return View();
        }

        public IActionResult Privacy()
        {
            return View();
        }

        [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
        public IActionResult Error()
        {
            return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
        }

        public IActionResult ProductionPlan()
        {
            // 初始化空模型，实际数据由前端通过API获取
            var model = new PlanModel
            {
                ProductItems = new System.Collections.Generic.List<ProductItem>()
            };
            return View(model);
        }

        /// <summary> 
        /// 生产计划详情页面
        /// </summary>
        public IActionResult ProductionPlanDetail()
        {
            // 详情页面的数据将由前端通过API获取
            return View();
        }

        /// <summary>
        /// 生产计划列表页面
        /// </summary>
        public IActionResult ProductionPlanList()
        {
            // 直接返回空的分页结果模型，数据将由前端通过API获取
            var queryModel = new ProductionPlanQueryModel();
            var result = new ProductionPlanPagedResult
            {
                Items = new System.Collections.Generic.List<ProductionPlanItem>(),
                TotalCount = 0,
                PageIndex = 1,
                PageSize = 10
            };
            ViewBag.QueryModel = queryModel;
            return View(result);
        }



        public IActionResult QueueMonitor()
        {
            return View();
        }
      
    }
}
